package jp.ne.hatena.d.digitalsoul.warikan.repositories

import jp.ne.hatena.d.digitalsoul.warikan.models._

object SlopeRepository {
	
	var slopes = Map[Int, Slope]()
	
	def nextId:Int = slopes.size + 1
	
	def add(slope:Slope) = slopes += (slope.id -> slope)
		
	def exists(id:Int):Boolean = slopes.contains(id)
	
	def forSlopeId(id:Int):Slope = slopes(id)
	
	def initialize = slopes = Map[Int, Slope]()
	
	def forAll:List[Slope] = slopes.values.toList
	
	def trace = {
		slopes.values.foreach { slope =>
			println(slope.roles)
		}
	}

}